# Definition for a binary tree node.
class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right


def deserializationTree(arr: list, i: int) -> TreeNode:
    if i > len(arr) - 1:
        return None
    if arr[i] is None:
        return None
    node = TreeNode(val=arr[i])
    node.left = deserializationTree(arr, 2*i+1)
    node.right = deserializationTree(arr, 2*i+2)

    return node
